<template>
  <div class="customerStatistics">
    <div class="formGroup">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px" class="">
        <el-form-item prop="userName2">
          <WeChat
            :options="options"
            @getValue="getValue"
            inputWidth="220px"
            :placeholder="`全部企微号`"
          ></WeChat>
        </el-form-item>
        <el-form-item prop="userName2">
          <div class="search">
            <el-input v-model="queryParams.userName1" size="small" placeholder="方案名称" clearable/>
            <el-button icon="el-icon-search" size="small" @click="handleQuery"></el-button>
          </div>
        </el-form-item>
        <el-form-item prop="userName2">
          <div class="search">
            <el-input v-model="queryParams.userName1" size="small" placeholder="方案ID" clearable/>
            <el-button icon="el-icon-search" size="small" @click="handleQuery"></el-button>
          </div>
        </el-form-item>
      </el-form>
    </div>
    <div class="tableAnalysis">
      <el-table
        :data="tableDataList"
        ref="customerMgtList"
      >
        <el-table-column
          :label="item.label"
          align="center"
          v-for="(item, index) in tableColumns"
          :key="index"
          :prop="item.key"
          :min-width="item.minWidth ? item.minWidth : ``"
          :fixed="item.fixed ? item.fixed : false"
          :show-overflow-tooltip="true"
        >
          <!--用于表格自定义-->
          <template slot="header" v-if="item.showHeaderTip">
            <div>
              {{ item.label }}
              <el-tooltip effect="dark" :content="item.showHeaderTip" placement="top">
                <span><i class="el-icon-question"></i></span>
              </el-tooltip>
            </div>
          </template>
          <template slot-scope="scope">
            <div>{{ scope.row[item.key] }}</div>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </div>
</template>
<script>
import {listUser} from "@/api/system/user";
import {getTime} from "@/utils";
import WeChat from "@/views/components/WeChat.vue";

export default {
  name: "NewOperations",
  components: {
    WeChat,
  },
  data() {
    return {
      queryParams: {},
      options: [{
        value: 1,
        label: '小红',
        WeChatNum: 2,
        WeChatName: '智行',
      }, {
        value: 2,
        label: '小军',
        WeChatNum: 1,
        WeChatName: '锐行',
      }, {
        value: 3,
        label: '小李',
        WeChatNum: 1,
        WeChatName: '锐行',
      }],
      tableHeight: 600,
      tableColumns: [
        {key: 'name', label: `方案ID`, visible: true, minWidth: 150, fixed: true},
        {key: 'mobile', label: `方案名称`, visible: true, minWidth: 150, fixed: false,},
        {key: 'email', label: `所属模式`, visible: true, minWidth: 200,},
        {key: 'last_login_time', label: `所属企微号`, visible: true, minWidth: 200,},
        {key: 'create_time', label: `操作内容`, visible: true, minWidth: 200,},
        {key: 'check_payCreate_time', label: `操作者`, visible: true, minWidth: 200,},
        {key: 'check_payCreate_time', label: `操作时间`, visible: true, minWidth: 200,},
      ],
      tableDataList: [],
      total: 8, // 表格的总条数
    }
  },
  watch: {},
  computed: {
  },
  created() {
    //this.getList();
    this.tableDataList = [];
     for (let i=0 ;i<3;i++){
       let obj={
         name:'2023-12-12',
         mobile:0,
         email:0,
         last_login_time:0,
         create_time:0,
         check_payCreate_time:0,
       }
       this.tableDataList.push(obj);
     }
  },
  methods: {
    getValue(obj) {
      console.log('获取行', obj);
    },
    getList() {
      this.loading = true;
      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
          this.tableDataList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
  },
}
</script>


<style scoped lang="scss">
.title {
  display: flex;
  align-items: center;
  padding: 16px 0 0;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 15px;
  position: relative;

  .icon {
    font-size: 12px;
    font-weight: 400;
    color: #3070ff;
    margin-left: 10px;
  }

  .time {
    position: absolute;
    right: 0px;
    top: 10px;
    color: #8C8C8C;
    font-size: 12px;
    font-weight: 400;
  }
}

.timeType {
  display: flex;
  align-items: center;
  margin-right: 10px;

  li {
    border: 1px solid #eee;
    height: 32px;
    margin: 0;
    padding: 0 15px;
    list-style: none;
    cursor: pointer;

    &.active {
      border-color: #2d8cf0;
      color: #2d8cf0;
    }
  }
}

.time-big {
  display: flex;
  align-items: center;
}

.formGroup {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.center-title {
  height: 30px;
  display: flex;
  align-items: center;

  span {
    content: "";
    width: 4px;
    height: 14px;
    background-color: #3070ff;
    display: block;
    margin-right: 5px;
  }
}

.tableAnalysis {
  padding-bottom: 20px;
  position: relative;

  .center-title {
    margin-bottom: 20px;
  }

  .exportData {
    position: absolute;
    right: 0px;
    top: 0px;

  }
}
.search {
  display: flex;

  ::v-deep.el-input__inner {
    border-right: none !important;
    border-radius: 4px 0px 0px 0px;
  }

  ::v-deep .el-button--default {
    border-radius: 0px 4px 4px 0px;
    padding: 0px 10px;
  }
}
::v-deep .el-form {
  .el-form-item {
    margin-bottom: 10px !important;
  }
}
</style>
